#define ElemType int

typedef struct ListNode List_Node;

#include "common.h"

char* longestCommonPrefix(char** strs, int strsSize);

int main()
{
	return 0;
}

char* longestCommonPrefix(char** strs, int strsSize)
{
	int longest = strlen(strs[0]);
	char* str_p = strs[0];
	if (!str_p[0])
		return str_p;

	for (int i = 1; i < strsSize; i++) {
		char* str = strs[i];
		for (int j = 0; j < longest; j++)
			if (!str[j] || str[j] != str_p[j]) {
				longest = j;
				break;
			}
	}

	printf("%d\n", longest);
	char* res = calloc(longest + 1, sizeof(char));
	strncpy(res, str_p, longest);
	return res;
}
